import http from '@/server'

/** 所有菜单列表 */
export async function getAllMenu(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/search',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 可用菜单列表 */
export async function getAvailableMenu(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/searchAllMenu',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 查询单个菜单 */
export async function getSingleMenuInfo(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/info ',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 新增菜单 */
export async function addMenu(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/add',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 修改菜单 */
export async function editMenu(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/update',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 禁用/启用菜单 */
export async function switchDisable(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/disable',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 删除菜单 */
export async function deleteMenu(data: Menu.MenuEntity) {
    return http.request({
      url: '/menu/del',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

/** 用户当前授权状态 */
export async function getUserMenu(data: Menu.MenuEntity) {
    return http.request({
      url: '/role_menu/info',
      method: 'post',
      headers: {
          'Content-Type': 'application/json', 
      },
      data
    })
}

